package com.isunland.managesystem.ui;

import android.support.v4.app.Fragment;
import com.isunland.managesystem.entity.EmployeeLoanContent;

public class EmployeePaymentActivity extends SingleFragmentActivity {

  protected static final String EXTRA_TYPE = "com.isunland.managesystem.ui.EXTRA_TYPE";
  // 判断是还款详情
  public static final int EXTRA_SHOWCONTENTTYPE = 0;
  // 判断是添加还款详情
  public static final int EXTRA_ADDCONTENTTYPE = 1;
  // 判断修改还款详情
  public static final int EXTRA_EDITCONTENTTYPE = 2;
  private android.support.v4.app.Fragment mFragment;

  @Override protected Fragment createFragment() {

    //根据type判断是添加还是现实详情
    int type = getIntent().getIntExtra(EXTRA_TYPE, 0);

    switch (type) {
      //详情界面
      case EXTRA_SHOWCONTENTTYPE:
        //接收传过来的content
        EmployeeLoanContent item = (EmployeeLoanContent) getIntent().getSerializableExtra(
            ShowEmployeePaymentFragment.EXTRA_EMPLOYEELOANContent);
        mFragment = ShowEmployeePaymentFragment.newInstance(item);
        break;
      //添加
      case EXTRA_ADDCONTENTTYPE:
        //接收传过来的content
        String code = getIntent().getStringExtra(AddEmployeePaymentFragment.EXTRA_CODE);
        mFragment = AddEmployeePaymentFragment.newInstance(code);
        break;
      //修改
      //				case EXTRA_EDITCONTENTTYPE:
      //					//接收传过来的content
      //					EmployeeLoanContent item2=(EmployeeLoanContent) getIntent().getSerializableExtra(EditEmployeePaymentFragment.EXTRA_VALUE);
      //					mFragment= EditEmployeePaymentFragment.newInstance(item2);
      //					break;
      default:
        break;
    }
    return mFragment;
  }
}